package ch03;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@WebServlet("/ch03/ptest/animal")
public class AnimalServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String food = request.getParameter("food");
		HttpSession session = request.getSession();
		session.setAttribute("food",food);
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();
		out.println("<title>성격 테스트</title>");
		out.println("<h3>좋아하는 동물은? </h3>");
		out.println("<form action=result>");
		out.println("<input type=text name=animal>");
		out.println("<input type=submit value=확인>");
		out.println("</form>");			
	}
}
